(* File lexer.mll *)
{
open Parser

let line = ref 1;;
}

rule token = parse
	[' ' '\t']	{ token lexbuf }
  | "/*"_*"*/" { token lexbuf  } (* Removes multiline comments *)
  | "//" [^'\n']* '\n' { Lexing.new_line lexbuf; token lexbuf } (* remove single line comments *)
	| '\n' 	{ Lexing.new_line lexbuf; token lexbuf }
	| '&' | "&&"	{ AND }
	| '|' | "||"	{ OR }
	| '^'	{ XOR }
	| ['!' '~'] { NOT }
	| '=' { EQUAL }
	| "!=" { NOTEQUAL }
	| "=>" { IMPLICATION }
	| '(' { LPAREN }
	| ')' { RPAREN }
	| ['T' '1'] { T }
	| ['F' '0'] { F }
  | '*'   { UNDET }
	| "skip" { SKIP }
	| "if" { IF }
	| "else" { ELSE }
	| "fi"	{ ENDIF	}
	| "elseif" { ELSEIF }
	| "then" { THEN }
	| "while" { WHILE }
	| "do" 	{ BEGINWHILE }
	| "od" 	{ ENDWHILE }
	| ';' { COMPOUND }
	| "decl" { DECLARATION }
	| "void" { VOID }
	| "bool" { BOOL }
	| "begin" { BEGINPROC }
	| "end" { ENDPROC }
	| ":=" { ASSIGNMENT }
	| ','	{ LISTSEPARATOR }
	| "return" { RETURN }
	| eof	{ EOF }
	| ['a'-'z''A'-'Z''0'-'9']+ as s { IDENTIFIER(s) }
	| _ as s { BADSEQUENCE(s) }
	